<% content_for :title do %>数据搜索

<% end %>
<script type="text/javascript">
$(function(){
  $("#chk_all").click(function(){
    $("#ul input[type='checkbox']").prop("checked",this.checked);
    
});


$(".chk_all").click(function(){
    $("#li_"+$(this).val()+" [type='checkbox']").prop("checked",this.checked);
});
});



</script>

<div class="alert alert-info" role="alert">
 <a name="hello"></a> 请输入关键字，选择需要搜索的分类
</div>

<form class="form-horizontal" action="<%= search_results_data_types_path %>" >
  <div class="form-group">
  <label class="col-sm-2 control-label">请输入关键字</label>
  <div class="col-sm-4 form-inline">
    <input type="text" class="form-control form-inline"/>
    <button type="submit" class="btn btn-default btn-primary form-inline">搜 索</button>
    <label><input type="checkbox" id="chk_all"  /> 全选 </label>
  </div>
</div>

<ul id="ul" class="list-group">

<% @data_types.each do |dt|%>
<li class="list-group-item" id="li_<%= dt.id %>">
<label class="label label-info"><%= dt.name %>
<input name="dt" type="checkbox" class="chk_all" value="<%= dt.id %>" /> <br>
</label>
      <% dt.subs.each do |s|%>
      <label class="">
        <input name="dts" type="checkbox"  value="<%= s.id%>" /><%= "#{s.no} #{s.name}" %>
        </label>
      <%end%>    
</li>
<%end%>
<li style="text-align:right;">
   <button type="submit" class="btn btn-default btn-primary form-inline">搜 索</button>
   <a href="#hello">回到顶部</a>
</li>
  
</ul>


</form>



